package com.study.kafka.consumer;

import com.study.kafka.message.Demo01Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author yuantongqin
 * 2021/8/4
 **/
@Component
public class Demo01Consumer {

    private Logger logger = LoggerFactory.getLogger(Demo01Consumer.class);

    @KafkaListener(topics = {Demo01Message.topic},
            groupId = "consumer-group-"+Demo01Message.topic)
    public void consumerInfo(List<Demo01Message> messages){

        logger.info("这里是批量消费："+messages.size()+"=="+messages.toString());
    }
}
